package com.mxl.dao.cashorder.impl;

import org.springframework.jdbc.core.JdbcTemplate;

public class SequenceDaoImpl {
	// extends BaseDaoSupport<Sequence, String> {
	private JdbcTemplate jdbcTemplate;

	public String getNextSeq(String seqName) {
		Long seqno = jdbcTemplate.queryForLong(
				"select SEQNO from SEQUENCE where NAME = ?",
				new Object[] { seqName });
		jdbcTemplate.update("update SEQUENCE set SEQNO = ? where NAME = ?",
				new Object[] { seqno + 1, seqName });
		return String.valueOf(seqno + 1);
	}

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

}
